
/****** Object:  Table [dbo].[Country]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Country](
	[CountryCode] [varchar](50) NOT NULL,
	[CountryName] [nvarchar](255) NULL,
 CONSTRAINT [PK_Country] PRIMARY KEY CLUSTERED 
(
	[CountryCode] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'004', N'AFGHANISTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'008', N'ALBANIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'012', N'ALGERIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'016', N'AMERICAN SAMOA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'020', N'ANDORRA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'024', N'ANGOLA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'028', N'ANTIGUA AND BARBUDA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'031', N'AZERBAIJAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'032', N'ARGENTINA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'036', N'AUSTRALIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'040', N'AUSTRIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'044', N'BAHAMAS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'048', N'BAHRAIN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'050', N'BANGLADESH')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'051', N'ARMENIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'052', N'BARBADOS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'056', N'BELGIUM')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'060', N'BERMUDA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'064', N'BHUTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'068', N'BOLIVIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'070', N'BOSNIA AND HERZEGOVINA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'072', N'BOTSWANA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'076', N'BRAZIL')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'084', N'BELIZE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'090', N'SOLOMON ISLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'092', N'VIRGIN ISLANDS, BRITISH')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'096', N'BRUNEI DARUSSALAM')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'100', N'BULGARIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'104', N'MYANMAR')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'108', N'BURUNDI')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'112', N'BELARUS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'116', N'CAMBODIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'120', N'CAMEROON')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'124', N'CANADA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'132', N'CAPE VERDE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'136', N'CAYMAN ISLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'140', N'CENTRAL AFRICAN REPUBLIC')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'144', N'SRI LANKA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'148', N'CHAD')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'152', N'CHILE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'156', N'CHINA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'158', N'TAIWAN, PROVINCE OF CHINA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'170', N'COLOMBIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'174', N'COMOROS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'178', N'CONGO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'180', N'CONGO, THE DEMOCRATIC REPUBLIC OF THE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'184', N'COOK ISLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'188', N'COSTA RICA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'191', N'CROATIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'192', N'CUBA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'196', N'CYPRUS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'203', N'CZECH REPUBLIC')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'204', N'BENIN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'208', N'DENMARK')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'212', N'DOMINICA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'214', N'DOMINICAN REPUBLIC')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'218', N'ECUADOR')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'222', N'EL SALVADOR')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'226', N'EQUATORIAL GUINEA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'231', N'ETHIOPIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'232', N'ERITREA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'233', N'ESTONIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'234', N'FAROE ISLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'238', N'FALKLAND ISLANDS (MALVINAS)')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'242', N'FIJI')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'246', N'FINLAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'250', N'FRANCE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'254', N'FRENCH GUIANA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'258', N'FRENCH POLYNESIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'262', N'DJIBOUTI')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'266', N'GABON')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'268', N'GEORGIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'270', N'GAMBIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'276', N'GERMANY')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'288', N'GHANA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'292', N'GIBRALTAR')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'296', N'KIRIBATI')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'300', N'GREECE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'304', N'GREENLAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'308', N'GRENADA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'312', N'GUADELOUPE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'316', N'GUAM')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'320', N'GUATEMALA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'324', N'GUINEA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'328', N'GUYANA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'332', N'HAITI')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'336', N'HOLY SEE (VATICAN CITY STATE)')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'340', N'HONDURAS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'344', N'HONG KONG')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'348', N'HUNGARY')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'352', N'ICELAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'356', N'INDIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'360', N'INDONESIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'364', N'IRAN, ISLAMIC REPUBLIC OF')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'368', N'IRAQ')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'372', N'IRELAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'376', N'ISRAEL')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'380', N'ITALY')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'384', N'COTE D''IVOIRE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'388', N'JAMAICA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'392', N'JAPAN')
GO
print 'Processed 100 total records'
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'398', N'KAZAKHSTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'400', N'JORDAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'404', N'KENYA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'408', N'KOREA, DEMOCRATIC PEOPLE''S REPUBLIC OF')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'410', N'KOREA, REPUBLIC OF')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'414', N'KUWAIT')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'417', N'KYRGYZSTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'418', N'LAO PEOPLE''S DEMOCRATIC REPUBLIC')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'422', N'LEBANON')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'426', N'LESOTHO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'428', N'LATVIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'430', N'LIBERIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'434', N'LIBYAN ARAB JAMAHIRIYA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'438', N'LIECHTENSTEIN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'440', N'LITHUANIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'442', N'LUXEMBOURG')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'446', N'MACAO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'450', N'MADAGASCAR')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'454', N'MALAWI')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'458', N'MALAYSIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'462', N'MALDIVES')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'466', N'MALI')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'470', N'MALTA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'474', N'MARTINIQUE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'478', N'MAURITANIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'480', N'MAURITIUS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'484', N'MEXICO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'492', N'MONACO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'496', N'MONGOLIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'498', N'MOLDOVA, REPUBLIC OF')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'500', N'MONTSERRAT')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'504', N'MOROCCO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'508', N'MOZAMBIQUE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'512', N'OMAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'516', N'NAMIBIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'520', N'NAURU')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'524', N'NEPAL')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'528', N'NETHERLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'530', N'NETHERLANDS ANTILLES')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'533', N'ARUBA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'540', N'NEW CALEDONIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'548', N'VANUATU')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'554', N'NEW ZEALAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'558', N'NICARAGUA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'562', N'NIGER')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'566', N'NIGERIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'570', N'NIUE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'574', N'NORFOLK ISLAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'578', N'NORWAY')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'580', N'NORTHERN MARIANA ISLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'583', N'MICRONESIA, FEDERATED STATES OF')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'584', N'MARSHALL ISLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'585', N'PALAU')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'586', N'PAKISTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'591', N'PANAMA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'598', N'PAPUA NEW GUINEA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'600', N'PARAGUAY')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'604', N'PERU')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'608', N'PHILIPPINES')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'612', N'PITCAIRN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'616', N'POLAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'620', N'PORTUGAL')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'624', N'GUINEA-BISSAU')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'630', N'PUERTO RICO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'634', N'QATAR')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'638', N'REUNION')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'642', N'ROMANIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'643', N'RUSSIAN FEDERATION')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'646', N'RWANDA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'654', N'SAINT HELENA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'659', N'SAINT KITTS AND NEVIS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'660', N'ANGUILLA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'662', N'SAINT LUCIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'666', N'SAINT PIERRE AND MIQUELON')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'670', N'SAINT VINCENT AND THE GRENADINES')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'674', N'SAN MARINO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'678', N'SAO TOME AND PRINCIPE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'682', N'SAUDI ARABIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'686', N'SENEGAL')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'690', N'SEYCHELLES')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'694', N'SIERRA LEONE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'702', N'SINGAPORE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'703', N'SLOVAKIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'704', N'VIET NAM')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'705', N'SLOVENIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'706', N'SOMALIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'710', N'SOUTH AFRICA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'716', N'ZIMBABWE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'724', N'SPAIN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'732', N'WESTERN SAHARA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'736', N'SUDAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'740', N'SURINAME')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'744', N'SVALBARD AND JAN MAYEN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'748', N'SWAZILAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'752', N'SWEDEN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'756', N'SWITZERLAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'760', N'SYRIAN ARAB REPUBLIC')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'762', N'TAJIKISTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'764', N'THAILAND')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'768', N'TOGO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'772', N'TOKELAU')
GO
print 'Processed 200 total records'
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'776', N'TONGA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'780', N'TRINIDAD AND TOBAGO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'784', N'UNITED ARAB EMIRATES')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'788', N'TUNISIA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'792', N'TURKEY')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'795', N'TURKMENISTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'796', N'TURKS AND CAICOS ISLANDS')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'798', N'TUVALU')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'800', N'UGANDA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'804', N'UKRAINE')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'807', N'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'818', N'EGYPT')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'826', N'UNITED KINGDOM')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'834', N'TANZANIA, UNITED REPUBLIC OF')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'840', N'UNITED STATES')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'850', N'VIRGIN ISLANDS, U.S.')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'854', N'BURKINA FASO')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'858', N'URUGUAY')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'860', N'UZBEKISTAN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'862', N'VENEZUELA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'876', N'WALLIS AND FUTUNA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'882', N'SAMOA')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'887', N'YEMEN')
INSERT [dbo].[Country] ([CountryCode], [CountryName]) VALUES (N'894', N'ZAMBIA')
/****** Object:  Table [dbo].[Customer]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Customer](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[SavingPoint] [int] NOT NULL,
	[UserName] [nvarchar](50) NOT NULL,
	[DefaultAddressId] [int] NULL,
	[CreateDate] [datetime] NOT NULL,
	[StarLevel] [int] NOT NULL,
	[MailAddress] [nvarchar](50) NULL,
	[FirstName] [nvarchar](20) NULL,
	[MiddleName] [nvarchar](20) NULL,
	[LastName] [nvarchar](20) NULL,
	[Gender] [int] NOT NULL,
	[Birthday] [datetime] NULL,
	[CountryCode] [varchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[Telphone] [varchar](50) NULL,
	[Mobile] [varchar](50) NULL,
 CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Customer] ON
INSERT [dbo].[Customer] ([Id], [SavingPoint], [UserName], [DefaultAddressId], [CreateDate], [StarLevel], [MailAddress], [FirstName], [MiddleName], [LastName], [Gender], [Birthday], [CountryCode], [City], [Telphone], [Mobile]) VALUES (1, 0, N'admin', NULL, CAST(0x00009ED1010E7C9A AS DateTime), 0, NULL, NULL, NULL, NULL, 0, CAST(0x0000000000000000 AS DateTime), NULL, NULL, NULL, NULL)
SET IDENTITY_INSERT [dbo].[Customer] OFF
/****** Object:  Table [dbo].[SupportTicket]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SupportTicket](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[CustomerId] [int] NOT NULL,
	[Subject] [nvarchar](500) NOT NULL,
	[Body] [nvarchar](max) NOT NULL,
	[Email] [varchar](120) NULL,
	[CreateDate] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
 CONSTRAINT [PK_SupportTicket] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0=created, 1= in progress, 2=closed, 3=givenup' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SupportTicket', @level2type=N'COLUMN',@level2name=N'Status'
GO
/****** Object:  Table [dbo].[SupportReply]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SupportReply](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[SupportTicketId] [int] NOT NULL,
	[Subject] [nvarchar](500) NOT NULL,
	[Body] [nvarchar](max) NOT NULL,
	[Email] [varchar](120) NULL,
	[CreateDate] [datetime] NOT NULL,
	[UserName] [nvarchar](50) NOT NULL,
	[IsAdminReply] [bit] NOT NULL,
 CONSTRAINT [PK_SupportReply] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Cart]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Cart](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[CustomerId] [int] NULL,
	[CreateDate] [datetime] NOT NULL,
	[Coupon] [nvarchar](50) NULL,
	[SubTotal] [decimal](18, 4) NOT NULL,
	[ShippingId] [int] NULL,
	[PaymentName] [nvarchar](50) NULL,
	[EmailAddress] [nvarchar](120) NULL,
	[FirstName] [nvarchar](50) NULL,
	[LastName] [nvarchar](50) NULL,
	[Address1] [nvarchar](255) NULL,
	[Address2] [nvarchar](255) NULL,
	[Postcode] [nvarchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[State] [nvarchar](50) NULL,
	[Country] [varchar](50) NULL,
	[Phone] [nvarchar](50) NULL,
	[UseInvoiceAddress] [bit] NOT NULL,
	[InvoiceFirstName] [nvarchar](50) NULL,
	[InvoiceLastName] [nvarchar](50) NULL,
	[InvoiceAddress1] [nvarchar](255) NULL,
	[InvoiceAddress2] [nvarchar](255) NULL,
	[InvoiceCity] [nvarchar](50) NULL,
	[InvoiceState] [nvarchar](50) NULL,
	[InvoiceCountry] [varchar](50) NULL,
	[InvoicePostcode] [char](10) NULL,
	[InvoicePhone] [varchar](50) NULL,
	[Remark] [nvarchar](500) NULL,
	[InsuredAmount] [decimal](18, 4) NOT NULL,
	[Discount] [decimal](18, 4) NOT NULL,
	[TotalDiscount] [decimal](18, 4) NOT NULL,
	[TotalTaxCost] [decimal](18, 4) NOT NULL,
	[Total] [decimal](18, 4) NOT NULL,
	[ShippingCost] [decimal](18, 4) NOT NULL,
	[PaymentMethodCost] [decimal](18, 4) NOT NULL,
	[IsOrdered] [bit] NOT NULL,
 CONSTRAINT [PK_Cart] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Street address, P.O. box, company name, c/o' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Cart', @level2type=N'COLUMN',@level2name=N'Address1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Apartment, suite, unit, building, floor, etc.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Cart', @level2type=N'COLUMN',@level2name=N'Address2'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'state, or province, or regiion.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Cart', @level2type=N'COLUMN',@level2name=N'State'
GO

/****** Object:  Table [dbo].[Order]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Order](
	[Id] [int] IDENTITY(10000,3) NOT NULL,
	[CustomerId] [int] NULL,
	[OrderDate] [datetime] NULL,
	[OrderStatus] [int] NOT NULL,
	[Coupon] [nvarchar](50) NULL,
	[IsCompleted] [bit] NOT NULL,
	[SubTotal] [decimal](18, 4) NOT NULL,
	[Total] [decimal](18, 4) NOT NULL,
	[ShippingId] [int] NOT NULL,
	[ShippingTrackingCode] [varchar](100) NULL,
	[PaymentName] [nvarchar](50) NULL,
	[UserName] [nvarchar](50) NULL,
	[FirstName] [nvarchar](50) NULL,
	[LastName] [nvarchar](50) NULL,
	[Address1] [nvarchar](255) NULL,
	[Address2] [nvarchar](255) NULL,
	[Postcode] [nvarchar](50) NULL,
	[Country] [nvarchar](255) NULL,
	[City] [nvarchar](50) NULL,
	[State] [nvarchar](50) NULL,
	[Phone] [nvarchar](50) NULL,
	[InvoiceFirstName] [nvarchar](50) NULL,
	[InvoiceLastName] [nvarchar](50) NULL,
	[InvoiceAddress1] [nvarchar](255) NULL,
	[InvoiceAddress2] [nvarchar](255) NULL,
	[InvoiceCity] [nvarchar](50) NULL,
	[InvoiceState] [nvarchar](50) NULL,
	[InvoicePostcode] [char](10) NULL,
	[InvoiceCountry] [nvarchar](255) NULL,
	[InvoicePhone] [varchar](50) NULL,
	[Remark] [nvarchar](500) NULL,
	[TotalWeight] [decimal](18, 4) NOT NULL,
	[InsuredAmount] [decimal](18, 4) NOT NULL,
	[Discount] [decimal](18, 4) NOT NULL,
	[TotalDiscount] [decimal](18, 4) NOT NULL,
	[TotalTaxCost] [decimal](18, 4) NOT NULL,
	[ShippingCost] [decimal](18, 4) NOT NULL,
	[PaymentMethodCost] [decimal](18, 4) NOT NULL,
	[CartId] [int] NULL,
 CONSTRAINT [PK_Order] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'the  moment when order is confirmed. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Order', @level2type=N'COLUMN',@level2name=N'OrderDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'status, 0= shopping cart, 1 = address, 2= shipping, 3 = confirm & payment, 4 = completed' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Order', @level2type=N'COLUMN',@level2name=N'OrderStatus'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'After payment is completed. order is finished!' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Order', @level2type=N'COLUMN',@level2name=N'IsCompleted'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Street address, P.O. box, company name, c/o' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Order', @level2type=N'COLUMN',@level2name=N'Address1'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Apartment, suite, unit, building, floor, etc.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Order', @level2type=N'COLUMN',@level2name=N'Address2'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'state, or province, or regiion.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Order', @level2type=N'COLUMN',@level2name=N'State'
GO

/****** Object:  Table [dbo].[OrderItem]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OrderItem](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[OrderId] [int] NOT NULL,
	[ProductId] [int] NOT NULL,
	[SaleItemId] [int] NOT NULL,
	[Quantity] [int] NOT NULL,
	[UnitPrice] [decimal](18, 4) NOT NULL,
	[ProductName] [nvarchar](255) NULL,
	[SKU] [nvarchar](50) NULL,
	[SubTotal] [decimal](18, 4) NOT NULL,
	[Discount] [decimal](18, 4) NOT NULL,
	[TaxCost] [decimal](18, 4) NOT NULL,
	[Total] [decimal](18, 4) NOT NULL,
 CONSTRAINT [PK_OrderItem] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'OrderItem', @level2type=N'COLUMN',@level2name=N'SaleItemId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The calculated discount value' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'OrderItem', @level2type=N'COLUMN',@level2name=N'Discount'
GO

/****** Object:  Table [dbo].[OrderItemVariation]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OrderItemVariation](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[OrderItemId] [int] NOT NULL,
	[Name] [nvarchar](500) NOT NULL,
	[Value] [nvarchar](1500) NOT NULL,
 CONSTRAINT [PK_OrderItemVariation] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[OrderItemVariation] ON
INSERT [dbo].[OrderItemVariation] ([Id], [OrderItemId], [Name], [Value]) VALUES (1, 1, N'Service Time', N'1Month')
INSERT [dbo].[OrderItemVariation] ([Id], [OrderItemId], [Name], [Value]) VALUES (2, 1, N'License', N'Single Developer')
INSERT [dbo].[OrderItemVariation] ([Id], [OrderItemId], [Name], [Value]) VALUES (3, 1, N'Version', N'Standard')
INSERT [dbo].[OrderItemVariation] ([Id], [OrderItemId], [Name], [Value]) VALUES (4, 2, N'Service Time', N'1Month')
INSERT [dbo].[OrderItemVariation] ([Id], [OrderItemId], [Name], [Value]) VALUES (5, 2, N'License', N'Single Developer')
INSERT [dbo].[OrderItemVariation] ([Id], [OrderItemId], [Name], [Value]) VALUES (6, 2, N'Version', N'Standard')
SET IDENTITY_INSERT [dbo].[OrderItemVariation] OFF
/****** Object:  Table [dbo].[OrderItemCustomField]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OrderItemCustomField](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[OrderItemId] [int] NOT NULL,
	[Name] [nvarchar](500) NOT NULL,
	[Value] [nvarchar](1500) NOT NULL,
 CONSTRAINT [PK_OrderItemCustomField] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[User]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[User](
	[Name] [nvarchar](50) NOT NULL,
	[Email] [nvarchar](100) NOT NULL,
	[FirstName] [nvarchar](20) NULL,
	[MiddleName] [nvarchar](20) NULL,
	[LastName] [nvarchar](20) NULL,
	[Gender] [smallint] NOT NULL,
	[Birthday] [datetime] NULL,
	[Country] [nvarchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[Address] [nvarchar](150) NULL,
	[Postcode] [nvarchar](30) NULL,
	[Telphone] [varchar](50) NULL,
	[Mobile] [varchar](50) NULL,
	[CreateDate] [datetime] NOT NULL,
	[FailedPasswordAnswerAttemptCount] [int] NOT NULL,
	[FailedPasswordAnswerAttemptWindowStart] [datetime] NULL,
	[FailedPasswordAttemptCount] [int] NOT NULL,
	[FailedPasswordAttemptWindowStart] [datetime] NULL,
	[IsApproved] [bit] NOT NULL,
	[IsLockedOut] [bit] NOT NULL,
	[LastLockoutDate] [datetime] NULL,
	[LastLoginDate] [datetime] NULL,
	[LastPasswordChangedDate] [datetime] NULL,
	[Password] [nvarchar](128) NULL,
	[PasswordAnswer] [nvarchar](128) NULL,
	[PasswordQuestion] [nvarchar](256) NULL,
	[PasswordSalt] [nvarchar](128) NULL,
	[CustomerId] [char](36) NULL,
	[Comment] [nvarchar](2000) NULL,
 CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED 
(
	[Name] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[User] ([Name], [Email], [FirstName], [MiddleName], [LastName], [Gender], [Birthday], [Country], [City], [Address], [Postcode], [Telphone], [Mobile], [CreateDate], [FailedPasswordAnswerAttemptCount], [FailedPasswordAnswerAttemptWindowStart], [FailedPasswordAttemptCount], [FailedPasswordAttemptWindowStart], [IsApproved], [IsLockedOut], [LastLockoutDate], [LastLoginDate], [LastPasswordChangedDate], [Password], [PasswordAnswer], [PasswordQuestion], [PasswordSalt], [CustomerId], [Comment]) VALUES (N'admin', N'admin@admin.com', N'administrator', NULL, N'', 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0x00009ED1010E7C9A AS DateTime), 0, NULL, 0, NULL, 1, 0, NULL, NULL, NULL, N'LIpOPyklx9vPcVk8/KUernTAS20=', NULL, NULL, N'20awLn6Pa32cdohidwH1zA==', NULL, NULL)
/****** Object:  Table [dbo].[Tax]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tax](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](150) NOT NULL,
	[Percent] [decimal](18, 4) NOT NULL,
 CONSTRAINT [PK_TaxRule] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Tax] ON
INSERT [dbo].[Tax] ([Id], [Name], [Percent]) VALUES (1, N'ALL', CAST(4.0000 AS Decimal(18, 4)))
SET IDENTITY_INSERT [dbo].[Tax] OFF
/****** Object:  Table [dbo].[Address]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Address](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[CustomerId] [int] NOT NULL,
	[FirstName] [nvarchar](50) NOT NULL,
	[LastName] [nvarchar](50) NOT NULL,
	[Address1] [nvarchar](255) NOT NULL,
	[Address2] [nvarchar](255) NOT NULL,
	[Postcode] [char](10) NOT NULL,
	[City] [nvarchar](50) NULL,
	[State] [nvarchar](50) NULL,
	[CountryCode] [varchar](50) NOT NULL,
	[Phone] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Address] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Brand]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Brand](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[Description] [nvarchar](2000) NULL,
	[Logo] [nvarchar](500) NULL,
 CONSTRAINT [PK_Brands] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Brand] ON
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (1, N'Wrox', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (2, N'Microsoft', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (3, N'Addison-Wesley', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (4, N'ASUS', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (5, N'Apple', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (6, N'HP', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (7, N'DELL', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (8, N'Levi''s', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (9, N'DIESEL', N'', N'')
INSERT [dbo].[Brand] ([Id], [Name], [Description], [Logo]) VALUES (10, N'Kooboo', N'', N'')
SET IDENTITY_INSERT [dbo].[Brand] OFF
/****** Object:  Table [dbo].[Administrator]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Administrator](
	[UserName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Administrator] PRIMARY KEY CLUSTERED 
(
	[UserName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[Administrator] ([UserName]) VALUES (N'admin')
/****** Object:  Table [dbo].[ImageSize]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImageSize](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Width] [decimal](18, 2) NOT NULL,
	[Height] [decimal](18, 2) NOT NULL,
	[IsCustom] [bit] NOT NULL,
 CONSTRAINT [PK_ImageSize] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductType]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductType](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[SkuAlias] [nvarchar](100) NULL,
	[IsEnable] [bit] NOT NULL,
	[HasSummary] [bit] NOT NULL,
	[HasDescription] [bit] NOT NULL,
	[HasPackageSize] [bit] NOT NULL,
	[HasWeight] [bit] NOT NULL,
 CONSTRAINT [PK_ProductTypes] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[ProductType] ON
INSERT [dbo].[ProductType] ([Id], [Name], [SkuAlias], [IsEnable], [HasSummary], [HasDescription], [HasPackageSize], [HasWeight]) VALUES (1, N'Clothing', N'SKU', 1, 1, 1, 1, 1)
INSERT [dbo].[ProductType] ([Id], [Name], [SkuAlias], [IsEnable], [HasSummary], [HasDescription], [HasPackageSize], [HasWeight]) VALUES (2, N'Shoes', N'SKU', 1, 1, 1, 1, 1)
INSERT [dbo].[ProductType] ([Id], [Name], [SkuAlias], [IsEnable], [HasSummary], [HasDescription], [HasPackageSize], [HasWeight]) VALUES (3, N'Book', N'SKU', 1, 1, 1, 1, 1)
INSERT [dbo].[ProductType] ([Id], [Name], [SkuAlias], [IsEnable], [HasSummary], [HasDescription], [HasPackageSize], [HasWeight]) VALUES (4, N'Computer', N'SKU', 1, 1, 1, 1, 1)
INSERT [dbo].[ProductType] ([Id], [Name], [SkuAlias], [IsEnable], [HasSummary], [HasDescription], [HasPackageSize], [HasWeight]) VALUES (5, N'Software', N'SKU', 1, 1, 1, 1, 1)
SET IDENTITY_INSERT [dbo].[ProductType] OFF
/****** Object:  Table [dbo].[Promotion_DiscountByProduct]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Promotion_DiscountByProduct](
	[DiscountRuleId] [int] NOT NULL,
	[ReduceType] [int] NOT NULL,
	[ReduceValue] [decimal](18, 3) NOT NULL,
	[ProductId] [int] NOT NULL,
 CONSTRAINT [PK_Promotion_DiscountByProduct] PRIMARY KEY CLUSTERED 
(
	[DiscountRuleId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Promotion_DiscountByCategory]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Promotion_DiscountByCategory](
	[DiscountRuleId] [int] NOT NULL,
	[ReduceType] [int] NOT NULL,
	[ReduceValue] [decimal](18, 3) NOT NULL,
	[CategoryId] [int] NOT NULL,
 CONSTRAINT [PK_Promotion_DiscountByCategory] PRIMARY KEY CLUSTERED 
(
	[DiscountRuleId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Promotion_DiscountByBrand]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Promotion_DiscountByBrand](
	[DiscountRuleId] [int] NOT NULL,
	[ReduceType] [int] NOT NULL,
	[ReduceValue] [decimal](18, 3) NOT NULL,
	[BrandId] [int] NOT NULL,
 CONSTRAINT [PK_Promotion_DiscountByBrand] PRIMARY KEY CLUSTERED 
(
	[DiscountRuleId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Promotion_CouponCode]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Promotion_CouponCode](
	[DiscountRuleId] [int] NOT NULL,
	[ReduceType] [int] NOT NULL,
	[ReduceValue] [decimal](18, 3) NOT NULL,
	[GouponCode] [varchar](32) NOT NULL,
 CONSTRAINT [PK_Promotion_DiscountCouponCode] PRIMARY KEY CLUSTERED 
(
	[DiscountRuleId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Promotion_Cashback]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Promotion_Cashback](
	[PromotionRuleId] [int] NOT NULL,
	[FromTotal] [decimal](18, 4) NULL,
	[ToTotal] [decimal](18, 4) NULL,
	[ReturnAmount] [decimal](18, 4) NOT NULL,
 CONSTRAINT [PK_Promotion_Cashback] PRIMARY KEY CLUSTERED 
(
	[PromotionRuleId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Category]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Category](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NULL,
	[ParentId] [int] NULL,
	[Description] [nvarchar](2000) NULL,
	[Photo] [nvarchar](500) NULL,
 CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Category] ON
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (1, N'Computer', NULL, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (2, N'Desktop', 1, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (3, N'Laptop', 1, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (4, N'Clothing', NULL, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (5, N'Women', 4, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (6, N'Men', 4, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (7, N'Kid', 4, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (8, N'Book', NULL, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (9, N'Computer Book', 8, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (10, N'Cooking', 8, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (11, N'Travelling', 8, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (12, N'Software', NULL, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (13, N'CMS', 12, N'', N'')
INSERT [dbo].[Category] ([Id], [Name], [ParentId], [Description], [Photo]) VALUES (14, N'eCommerce', 12, N'', N'')
SET IDENTITY_INSERT [dbo].[Category] OFF
/****** Object:  Table [dbo].[Shipping]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Shipping](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](500) NOT NULL,
 CONSTRAINT [PK_Shipping_1] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Shipping] ON
INSERT [dbo].[Shipping] ([Id], [Name]) VALUES (1, N'DHL')
INSERT [dbo].[Shipping] ([Id], [Name]) VALUES (2, N'FedEx')
SET IDENTITY_INSERT [dbo].[Shipping] OFF
/****** Object:  Table [dbo].[PromotionRule]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PromotionRule](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](150) NULL,
	[StartDate] [datetime] NULL,
	[EndDate] [datetime] NULL,
	[Priority] [int] NOT NULL,
	[IsEnable] [bit] NOT NULL,
	[PromotionName] [varchar](255) NOT NULL,
 CONSTRAINT [PK_PromotionRule] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[PromotionLog]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PromotionLog](
	[Id] [int] NOT NULL,
	[OrderId] [int] NOT NULL,
	[OrderItemId] [int] NULL,
	[PromotionRuleId] [int] NOT NULL,
	[ProductId] [int] NULL,
	[UserName] [nvarchar](50) NULL,
	[Remark] [nvarchar](500) NULL,
	[Discount] [decimal](18, 4) NOT NULL,
 CONSTRAINT [PK_PromotionLog] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Payment_Paypal_OrderToken]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Payment_Paypal_OrderToken](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[OrderID] [int] NOT NULL,
	[TimeStamp] [datetime] NULL,
	[Correlation] [varchar](64) NULL,
	[Build] [varchar](64) NULL,
	[PayKey] [varchar](128) NULL,
	[ExecStatus] [tinyint] NULL,
	[OrderTraceToken] [uniqueidentifier] NOT NULL,
	[CreateTime] [datetime] NOT NULL,
 CONSTRAINT [PK_Payment_Paypal_OrderToken_1] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Payment_Paypal_OrderToken] ON
INSERT [dbo].[Payment_Paypal_OrderToken] ([Id], [OrderID], [TimeStamp], [Correlation], [Build], [PayKey], [ExecStatus], [OrderTraceToken], [CreateTime]) VALUES (1, 10003, NULL, NULL, NULL, N'AP-2SB38869P9442323W', 1, N'93f39ec1-b65a-4858-9a2c-72a6f0b55a86', CAST(0x00009ED200BD84AC AS DateTime))
SET IDENTITY_INSERT [dbo].[Payment_Paypal_OrderToken] OFF
/****** Object:  Table [dbo].[Payment_Paypal]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Payment_Paypal](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[APIUsername] [nvarchar](50) NOT NULL,
	[APIPassword] [nvarchar](500) NOT NULL,
	[APISignature] [nvarchar](500) NOT NULL,
	[MerchantAccount] [varchar](256) NULL,
	[GoLive] [bit] NOT NULL,
 CONSTRAINT [PK_Payment_Paypal] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Payment_Paypal] ON
INSERT [dbo].[Payment_Paypal] ([Id], [APIUsername], [APIPassword], [APISignature], [MerchantAccount], [GoLive]) VALUES (1, N'APIUsername', N'APIPassword', N'APISignature', N'kooboo@kooboo.com', 0)
SET IDENTITY_INSERT [dbo].[Payment_Paypal] OFF
/****** Object:  Table [dbo].[Payment]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Payment](
	[MethodName] [varchar](255) NOT NULL,
	[HeadLine] [nvarchar](500) NOT NULL,
	[AmountChange] [decimal](18, 4) NULL,
	[PercentChange] [decimal](18, 2) NULL,
	[IsEnable] [bit] NOT NULL,
	[IsRedirect] [bit] NOT NULL,
	[PaymentMode] [smallint] NOT NULL,
 CONSTRAINT [PK_Payment] PRIMARY KEY CLUSTERED 
(
	[MethodName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'This is the class name of the payment method.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Payment', @level2type=N'COLUMN',@level2name=N'MethodName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The increase or decrease amount when choose this payment method. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Payment', @level2type=N'COLUMN',@level2name=N'AmountChange'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The increase or decrease percent when choose this payment method. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Payment', @level2type=N'COLUMN',@level2name=N'PercentChange'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Redirect means that payment will be redirected to third party site. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Payment', @level2type=N'COLUMN',@level2name=N'IsRedirect'
GO
INSERT [dbo].[Payment] ([MethodName], [HeadLine], [AmountChange], [PercentChange], [IsEnable], [IsRedirect], [PaymentMode]) VALUES (N'Paypal', N'Paypal', CAST(10.0000 AS Decimal(18, 4)), CAST(0.00 AS Decimal(18, 2)), 1, 1, 0)
/****** Object:  Table [dbo].[ShopSetting]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ShopSetting](
	[Id] [int] NOT NULL,
	[PriceIndex] [decimal](18, 4) NOT NULL,
	[ThreadCulture] [nvarchar](50) NULL,
	[CurrencyISOCode] [char](3) NULL,
	[SizeUnit] [nvarchar](10) NOT NULL,
	[WeightUnit] [nvarchar](10) NOT NULL,
	[EnableStock] [bit] NOT NULL,
	[ThumbnailWidth] [int] NOT NULL,
	[ThumbnailHeight] [int] NOT NULL,
	[DefaultDeliveryDays] [int] NOT NULL,
 CONSTRAINT [PK_ShopSetting] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'this can be used to increase price for whole site or used as an exchange rate to different currency.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShopSetting', @level2type=N'COLUMN',@level2name=N'PriceIndex'
GO
/****** Object:  Table [dbo].[SubTax]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SubTax](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[TaxId] [int] NOT NULL,
	[CountryCode] [varchar](50) NOT NULL,
	[State] [varchar](50) NOT NULL,
	[Percent] [decimal](18, 4) NOT NULL,
 CONSTRAINT [PK_SubTax] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[ShippingCostRule]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ShippingCostRule](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[ShippingId] [int] NOT NULL,
	[From] [decimal](18, 4) NOT NULL,
	[To] [decimal](18, 4) NOT NULL,
	[Cost] [decimal](18, 4) NOT NULL,
 CONSTRAINT [PK_ShippingCostRule] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[ShippingCostRule] ON
INSERT [dbo].[ShippingCostRule] ([Id], [ShippingId], [From], [To], [Cost]) VALUES (1, 1, CAST(0.0000 AS Decimal(18, 4)), CAST(10.0000 AS Decimal(18, 4)), CAST(3.0000 AS Decimal(18, 4)))
INSERT [dbo].[ShippingCostRule] ([Id], [ShippingId], [From], [To], [Cost]) VALUES (2, 1, CAST(11.0000 AS Decimal(18, 4)), CAST(100.0000 AS Decimal(18, 4)), CAST(5.0000 AS Decimal(18, 4)))
INSERT [dbo].[ShippingCostRule] ([Id], [ShippingId], [From], [To], [Cost]) VALUES (3, 2, CAST(0.0000 AS Decimal(18, 4)), CAST(10.0000 AS Decimal(18, 4)), CAST(3.5000 AS Decimal(18, 4)))
INSERT [dbo].[ShippingCostRule] ([Id], [ShippingId], [From], [To], [Cost]) VALUES (4, 2, CAST(11.0000 AS Decimal(18, 4)), CAST(500.0000 AS Decimal(18, 4)), CAST(5.5000 AS Decimal(18, 4)))
SET IDENTITY_INSERT [dbo].[ShippingCostRule] OFF
/****** Object:  Table [dbo].[PromotionExclusiveRules]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PromotionExclusiveRules](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[PromotionRuleId1] [int] NOT NULL,
	[PromotionRuleId2] [int] NOT NULL,
 CONSTRAINT [PK_PromotionExclusiveRules] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductAttribute]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductAttribute](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[EntityType] [int] NOT NULL,
	[Name] [nvarchar](150) NOT NULL,
	[Sequence] [int] NOT NULL,
	[ProductTypeId] [int] NOT NULL,
	[DataFormat] [int] NOT NULL,
	[Selections] [nvarchar](2000) NULL,
	[DefaultValues] [nvarchar](100) NULL,
	[WebControlName] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_ProductAttribute] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[ProductAttribute] ON
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (1, 1, N'Size', 0, 1, 0, N'29
30
31
32
33
34
36
38
40
42', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (2, 1, N'Color', 1, 1, 0, N'Yellow
Red
Blue
Black
White', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (3, 1, N'Size', 0, 2, 0, N'8F(M)UK
9F(M)UK
10F(M)UK
11F(M)UK
12F(M)UK', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (4, 1, N'Color', 1, 2, 0, N'Black
White
Green', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (5, 0, N'Page Number', 0, 3, 0, N'', N'', N'Textbox')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (6, 0, N'Publisher', 1, 3, 0, N'Microsoft
Wrox
Addison-Wesley ', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (7, 1, N'Format', 0, 3, 0, N'Paperback
Hardcover
PDF', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (8, 1, N'CPU', 0, 4, 0, N'I3
I5
I7', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (9, 1, N'Screen Size', 1, 4, 0, N'19''
22''
34''', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (11, 1, N'Service Time', 0, 5, 0, N'1Month
6Month
12Month
2Years', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (12, 1, N'License', 1, 5, 0, N'Single Developer
10 Developer
50 Developer
Company', N'', N'DropdownList')
INSERT [dbo].[ProductAttribute] ([Id], [EntityType], [Name], [Sequence], [ProductTypeId], [DataFormat], [Selections], [DefaultValues], [WebControlName]) VALUES (13, 1, N'Version', 2, 5, 0, N'Standard
Pro
Ultimate', N'', N'DropdownList')
SET IDENTITY_INSERT [dbo].[ProductAttribute] OFF
/****** Object:  Table [dbo].[Product]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Product](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[TaxId] [int] NULL,
	[SKU] [nvarchar](50) NULL,
	[Name] [nvarchar](255) NULL,
	[Summary] [nvarchar](500) NULL,
	[Description] [nvarchar](max) NULL,
	[Weight] [decimal](18, 4) NULL,
	[PackageSize_Height] [decimal](18, 4) NULL,
	[PackageSize_Width] [decimal](18, 4) NULL,
	[PackageSize_Length] [decimal](18, 4) NULL,
	[BrandId] [int] NULL,
	[ProductTypeId] [int] NULL,
	[Hidden] [bit] NOT NULL,
	[CanBackOrder] [bit] NOT NULL,
	[Stars] [int] NOT NULL,
 CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'when = 1, it will be taken out from shop.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'Hidden'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'when =1, it can be ordered even when stock is 0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Product', @level2type=N'COLUMN',@level2name=N'CanBackOrder'
GO
SET IDENTITY_INSERT [dbo].[Product] ON
INSERT [dbo].[Product] ([Id], [TaxId], [SKU], [Name], [Summary], [Description], [Weight], [PackageSize_Height], [PackageSize_Width], [PackageSize_Length], [BrandId], [ProductTypeId], [Hidden], [CanBackOrder], [Stars]) VALUES (2, 1, NULL, N'Macbook', N'', N'', NULL, NULL, NULL, NULL, 5, 4, 0, 0, 0)
INSERT [dbo].[Product] ([Id], [TaxId], [SKU], [Name], [Summary], [Description], [Weight], [PackageSize_Height], [PackageSize_Width], [PackageSize_Length], [BrandId], [ProductTypeId], [Hidden], [CanBackOrder], [Stars]) VALUES (3, 1, NULL, N'Kooboo eCommerce', N'', N'', NULL, NULL, NULL, NULL, 10, 5, 0, 0, 0)
SET IDENTITY_INSERT [dbo].[Product] OFF
/****** Object:  Table [dbo].[ProductReview]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductReview](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[OrderId] [int] NOT NULL,
	[ProductId] [int] NOT NULL,
	[Rate] [int] NOT NULL,
	[Remark] [nvarchar](1000) NOT NULL,
	[CreateDate] [datetime] NOT NULL,
	[IsPublished] [bit] NOT NULL,
	[CustomerId] [int] NOT NULL,
 CONSTRAINT [PK_ProductReview] PRIMARY KEY NONCLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'from 0 to 4, in the page, it will be 1-5. 5 is the best. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductReview', @level2type=N'COLUMN',@level2name=N'Rate'
GO
/****** Object:  Table [dbo].[BrandProductType]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BrandProductType](
	[BrandId] [int] NOT NULL,
	[ProductTypeId] [int] NOT NULL,
 CONSTRAINT [PK_BrandProductType] PRIMARY KEY CLUSTERED 
(
	[BrandId] ASC,
	[ProductTypeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (1, 3)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (2, 3)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (3, 3)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (4, 4)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (5, 4)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (6, 4)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (7, 4)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (8, 1)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (8, 2)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (9, 1)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (9, 2)
INSERT [dbo].[BrandProductType] ([BrandId], [ProductTypeId]) VALUES (10, 5)
/****** Object:  Table [dbo].[ValidationRule]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ValidationRule](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[ProductAttributeId] [int] NOT NULL,
	[ValidatorName] [nvarchar](50) NULL,
	[Parameters] [nvarchar](500) NULL,
	[ErrorMessage] [nvarchar](500) NULL,
 CONSTRAINT [PK_ValidationRule] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0=CustomField,1=Variation' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ValidationRule', @level2type=N'COLUMN',@level2name=N'ProductAttributeId'
GO
SET IDENTITY_INSERT [dbo].[ValidationRule] ON
INSERT [dbo].[ValidationRule] ([Id], [ProductAttributeId], [ValidatorName], [Parameters], [ErrorMessage]) VALUES (1, 3, N'Required', N'[]', N'Please choose shoes size')
INSERT [dbo].[ValidationRule] ([Id], [ProductAttributeId], [ValidatorName], [Parameters], [ErrorMessage]) VALUES (2, 4, N'Required', N'[]', N'Please choose shoes color')
INSERT [dbo].[ValidationRule] ([Id], [ProductAttributeId], [ValidatorName], [Parameters], [ErrorMessage]) VALUES (3, 7, N'Required', N'[]', N'Please choose format')
INSERT [dbo].[ValidationRule] ([Id], [ProductAttributeId], [ValidatorName], [Parameters], [ErrorMessage]) VALUES (4, 11, N'Required', N'[]', N'Please choose service time')
INSERT [dbo].[ValidationRule] ([Id], [ProductAttributeId], [ValidatorName], [Parameters], [ErrorMessage]) VALUES (5, 12, N'Required', N'[]', N'Please choose license type')
INSERT [dbo].[ValidationRule] ([Id], [ProductAttributeId], [ValidatorName], [Parameters], [ErrorMessage]) VALUES (6, 13, N'Required', N'[]', N'Please choose version')
SET IDENTITY_INSERT [dbo].[ValidationRule] OFF
/****** Object:  Table [dbo].[CategoryProduct]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CategoryProduct](
	[CategoryId] [int] NOT NULL,
	[ProductId] [int] NOT NULL,
 CONSTRAINT [PK_CategoryProduct] PRIMARY KEY CLUSTERED 
(
	[CategoryId] ASC,
	[ProductId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[CategoryProduct] ([CategoryId], [ProductId]) VALUES (1, 2)
INSERT [dbo].[CategoryProduct] ([CategoryId], [ProductId]) VALUES (3, 2)
INSERT [dbo].[CategoryProduct] ([CategoryId], [ProductId]) VALUES (14, 3)
/****** Object:  Table [dbo].[SaleItem]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SaleItem](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[ProductId] [int] NOT NULL,
	[SKU] [nvarchar](150) NOT NULL,
	[PurchasePrice] [decimal](18, 4) NOT NULL,
	[RetailPrice] [decimal](18, 4) NOT NULL,
	[Stock] [int] NOT NULL,
	[DeliveryDays] [int] NOT NULL,
 CONSTRAINT [PK_SaleItem] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[SaleItem] ON
INSERT [dbo].[SaleItem] ([Id], [ProductId], [SKU], [PurchasePrice], [RetailPrice], [Stock], [DeliveryDays]) VALUES (2, 2, N'MC700LL/A', CAST(999.0000 AS Decimal(18, 4)), CAST(999.0000 AS Decimal(18, 4)), 0, 3)
INSERT [dbo].[SaleItem] ([Id], [ProductId], [SKU], [PurchasePrice], [RetailPrice], [Stock], [DeliveryDays]) VALUES (3, 3, N'KBE0101/S', CAST(199.0000 AS Decimal(18, 4)), CAST(299.0000 AS Decimal(18, 4)), 0, 1)
INSERT [dbo].[SaleItem] ([Id], [ProductId], [SKU], [PurchasePrice], [RetailPrice], [Stock], [DeliveryDays]) VALUES (4, 3, N'KBE0110/S', CAST(599.0000 AS Decimal(18, 4)), CAST(699.0000 AS Decimal(18, 4)), 0, 1)
INSERT [dbo].[SaleItem] ([Id], [ProductId], [SKU], [PurchasePrice], [RetailPrice], [Stock], [DeliveryDays]) VALUES (5, 3, N'KBE0150/S', CAST(3999.0000 AS Decimal(18, 4)), CAST(4999.0000 AS Decimal(18, 4)), 0, 1)
INSERT [dbo].[SaleItem] ([Id], [ProductId], [SKU], [PurchasePrice], [RetailPrice], [Stock], [DeliveryDays]) VALUES (6, 3, N'KBE2C/U', CAST(19999.0000 AS Decimal(18, 4)), CAST(29999.0000 AS Decimal(18, 4)), 0, 5)
SET IDENTITY_INSERT [dbo].[SaleItem] OFF
/****** Object:  Table [dbo].[CartItem]    Script Date: 04/27/2011 18:30:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CartItem](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[CartId] [int] NOT NULL,
	[ProductId] [int] NOT NULL,
	[SaleItemId] [int] NOT NULL,
	[Quantity] [int] NOT NULL,
	[UnitPrice] [decimal](18, 4) NOT NULL,
	[ProductName] [nvarchar](255) NULL,
	[SKU] [nvarchar](50) NULL,
	[ProductCustomFields] [nvarchar](max) NULL,
	[ProductVariations] [nvarchar](max) NULL,
	[SubTotal] [decimal](18, 4) NOT NULL,
	[Discount] [decimal](18, 4) NOT NULL,
	[TaxCost] [decimal](18, 4) NOT NULL,
	[Total] [decimal](18, 4) NOT NULL,
 CONSTRAINT [PK_CartItem] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CartItem', @level2type=N'COLUMN',@level2name=N'SaleItemId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'data from ProductAttributes and ProductAttributeValues' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CartItem', @level2type=N'COLUMN',@level2name=N'ProductCustomFields'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'data from ProductPriceAttributes and ProductPriceAttributeValues' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CartItem', @level2type=N'COLUMN',@level2name=N'ProductVariations'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The calculated discount value' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CartItem', @level2type=N'COLUMN',@level2name=N'Discount'
GO

/****** Object:  Table [dbo].[ProductQuestion]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ProductQuestion](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[ProductId] [int] NOT NULL,
	[QuestionBy] [nvarchar](50) NOT NULL,
	[Question] [nvarchar](2000) NOT NULL,
	[Answer] [nvarchar](2000) NULL,
	[AnsweredBy] [nvarchar](50) NULL,
	[QuestionDate] [datetime] NULL,
	[QuestionEmail] [varchar](120) NULL,
	[AnswerDate] [datetime] NULL,
 CONSTRAINT [PK_ProductQuestion] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[ProductImage]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductImage](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](500) NOT NULL,
	[ProductId] [int] NOT NULL,
	[CoverImage] [bit] NOT NULL,
 CONSTRAINT [PK_ProductImages] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductCustomField]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductCustomField](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[ProductId] [int] NOT NULL,
	[CustomFieldId] [int] NOT NULL,
	[Value] [nvarchar](1500) NULL,
	[NumberValue] [decimal](18, 2) NULL,
	[DateTimeValue] [datetime] NULL,
 CONSTRAINT [PK_ProductCustomField] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductVariation]    Script Date: 04/27/2011 18:30:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductVariation](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[VariationId] [int] NOT NULL,
	[SaleItemId] [int] NOT NULL,
	[Value] [nvarchar](1500) NULL,
	[DateTimeValue] [datetime] NULL,
	[NumberValue] [decimal](18, 2) NULL,
 CONSTRAINT [PK_ProductVariation] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[ProductVariation] ON
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (4, 8, 2, N'I3', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (5, 9, 2, N'19', NULL, CAST(19.00 AS Decimal(18, 2)))
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (6, 11, 3, N'1Month', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (7, 12, 3, N'Single Developer', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (8, 13, 3, N'Standard', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (9, 11, 4, N'1Month', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (10, 12, 4, N'10 Developer', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (11, 13, 4, N'Standard', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (12, 11, 5, N'1Month', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (13, 12, 5, N'50 Developer', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (14, 13, 5, N'Standard', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (15, 11, 6, N'2Years', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (16, 12, 6, N'Company', NULL, NULL)
INSERT [dbo].[ProductVariation] ([Id], [VariationId], [SaleItemId], [Value], [DateTimeValue], [NumberValue]) VALUES (17, 13, 6, N'Ultimate', NULL, NULL)
SET IDENTITY_INSERT [dbo].[ProductVariation] OFF
/****** Object:  Default [DF_Cart_CreateDate]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_CreateDate]  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_Cart_SubTotal]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_SubTotal]  DEFAULT ((0)) FOR [SubTotal]
GO
/****** Object:  Default [DF_Cart_UseInvoiceAddress]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_UseInvoiceAddress]  DEFAULT ((0)) FOR [UseInvoiceAddress]
GO
/****** Object:  Default [DF_Cart_InsuredAmount]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_InsuredAmount]  DEFAULT ((0)) FOR [InsuredAmount]
GO
/****** Object:  Default [DF_Cart_OrderDiscount]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_OrderDiscount]  DEFAULT ((0)) FOR [Discount]
GO
/****** Object:  Default [DF_Cart_TotalDiscount]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_TotalDiscount]  DEFAULT ((0)) FOR [TotalDiscount]
GO
/****** Object:  Default [DF_Cart_TotalTaxCost]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_TotalTaxCost]  DEFAULT ((0)) FOR [TotalTaxCost]
GO
/****** Object:  Default [DF_Cart_Total]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_Total]  DEFAULT ((0)) FOR [Total]
GO
/****** Object:  Default [DF_Cart_ShippingCost]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_ShippingCost]  DEFAULT ((0)) FOR [ShippingCost]
GO
/****** Object:  Default [DF_Cart_PaymentMethodCost]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_PaymentMethodCost]  DEFAULT ((0)) FOR [PaymentMethodCost]
GO
/****** Object:  Default [DF_Cart_IsOrdered]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart] ADD  CONSTRAINT [DF_Cart_IsOrdered]  DEFAULT ((0)) FOR [IsOrdered]
GO
/****** Object:  Default [DF_CartItem_Quantity]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem] ADD  CONSTRAINT [DF_CartItem_Quantity]  DEFAULT ((1)) FOR [Quantity]
GO
/****** Object:  Default [DF_CartItem_UnitPrice]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem] ADD  CONSTRAINT [DF_CartItem_UnitPrice]  DEFAULT ((0)) FOR [UnitPrice]
GO
/****** Object:  Default [DF_CartItem_SubTotal]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem] ADD  CONSTRAINT [DF_CartItem_SubTotal]  DEFAULT ((0)) FOR [SubTotal]
GO
/****** Object:  Default [DF_CartItem_Discount]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem] ADD  CONSTRAINT [DF_CartItem_Discount]  DEFAULT ((0)) FOR [Discount]
GO
/****** Object:  Default [DF_CartItem_TaxCost]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem] ADD  CONSTRAINT [DF_CartItem_TaxCost]  DEFAULT ((0)) FOR [TaxCost]
GO
/****** Object:  Default [DF_CartItem_Total]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem] ADD  CONSTRAINT [DF_CartItem_Total]  DEFAULT ((0)) FOR [Total]
GO
/****** Object:  Default [DF_Customer_SavingPoint]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_SavingPoint]  DEFAULT ((0)) FOR [SavingPoint]
GO
/****** Object:  Default [DF_Customer_CreateDate]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_CreateDate]  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_Customer_StarLevel]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_StarLevel]  DEFAULT ((0)) FOR [StarLevel]
GO
/****** Object:  Default [DF_Customer_Gender_1]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_Gender_1]  DEFAULT ((0)) FOR [Gender]
GO
/****** Object:  Default [DF_Customer_Birthday_1]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_Birthday_1]  DEFAULT ((0)) FOR [Birthday]
GO
/****** Object:  Default [DF_ImageSize_Width]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[ImageSize] ADD  CONSTRAINT [DF_ImageSize_Width]  DEFAULT ((0)) FOR [Width]
GO
/****** Object:  Default [DF_ImageSize_Height]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[ImageSize] ADD  CONSTRAINT [DF_ImageSize_Height]  DEFAULT ((0)) FOR [Height]
GO
/****** Object:  Default [DF_ImageSize_IsCustom]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[ImageSize] ADD  CONSTRAINT [DF_ImageSize_IsCustom]  DEFAULT ((1)) FOR [IsCustom]
GO
/****** Object:  Default [DF_Order_OrderStatus]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_OrderStatus]  DEFAULT ((0)) FOR [OrderStatus]
GO
/****** Object:  Default [DF_Order_IsCompleted]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_IsCompleted]  DEFAULT ((0)) FOR [IsCompleted]
GO
/****** Object:  Default [DF_Order_SubTotalPrice]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_SubTotalPrice]  DEFAULT ((0)) FOR [SubTotal]
GO
/****** Object:  Default [DF_Order_Total]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_Total]  DEFAULT ((0)) FOR [Total]
GO
/****** Object:  Default [DF_Order_TotalWeight]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_TotalWeight]  DEFAULT ((0)) FOR [TotalWeight]
GO
/****** Object:  Default [DF_Order_InsuredAmount]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_InsuredAmount]  DEFAULT ((0)) FOR [InsuredAmount]
GO
/****** Object:  Default [DF_Order_Discount]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_Discount]  DEFAULT ((0)) FOR [Discount]
GO
/****** Object:  Default [DF_Order_TotalDiscount]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_TotalDiscount]  DEFAULT ((0)) FOR [TotalDiscount]
GO
/****** Object:  Default [DF_Order_TotalTaxCost]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_TotalTaxCost]  DEFAULT ((0)) FOR [TotalTaxCost]
GO
/****** Object:  Default [DF_Order_ShippingCost]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_ShippingCost]  DEFAULT ((0)) FOR [ShippingCost]
GO
/****** Object:  Default [DF_Order_PaymentCost]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order] ADD  CONSTRAINT [DF_Order_PaymentCost]  DEFAULT ((0)) FOR [PaymentMethodCost]
GO
/****** Object:  Default [DF_OrdeItem_Amount]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItem] ADD  CONSTRAINT [DF_OrdeItem_Amount]  DEFAULT ((1)) FOR [Quantity]
GO
/****** Object:  Default [DF_OrderItem_UnitPrice]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItem] ADD  CONSTRAINT [DF_OrderItem_UnitPrice]  DEFAULT ((0)) FOR [UnitPrice]
GO
/****** Object:  Default [DF_OrderItem_TotalPrice]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItem] ADD  CONSTRAINT [DF_OrderItem_TotalPrice]  DEFAULT ((0)) FOR [SubTotal]
GO
/****** Object:  Default [DF_OrderItem_Discount]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItem] ADD  CONSTRAINT [DF_OrderItem_Discount]  DEFAULT ((0)) FOR [Discount]
GO
/****** Object:  Default [DF_OrderItem_TaxCost]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItem] ADD  CONSTRAINT [DF_OrderItem_TaxCost]  DEFAULT ((0)) FOR [TaxCost]
GO
/****** Object:  Default [DF_OrderItem_Total]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItem] ADD  CONSTRAINT [DF_OrderItem_Total]  DEFAULT ((0)) FOR [Total]
GO
/****** Object:  Default [DF_Table_1_AmountIncreased]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Payment] ADD  CONSTRAINT [DF_Table_1_AmountIncreased]  DEFAULT ((0)) FOR [AmountChange]
GO
/****** Object:  Default [DF_Payment_PercentChange]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Payment] ADD  CONSTRAINT [DF_Payment_PercentChange]  DEFAULT ((0)) FOR [PercentChange]
GO
/****** Object:  Default [DF_Payment_IsEnable]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Payment] ADD  CONSTRAINT [DF_Payment_IsEnable]  DEFAULT ((0)) FOR [IsEnable]
GO
/****** Object:  Default [DF_PaymentMethod_IsRedirect]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Payment] ADD  CONSTRAINT [DF_PaymentMethod_IsRedirect]  DEFAULT ((1)) FOR [IsRedirect]
GO
/****** Object:  Default [DF_Payment_PaymentMode]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Payment] ADD  CONSTRAINT [DF_Payment_PaymentMode]  DEFAULT ((0)) FOR [PaymentMode]
GO
/****** Object:  Default [DF_Payment_Paypal_GoLive]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Payment_Paypal] ADD  CONSTRAINT [DF_Payment_Paypal_GoLive]  DEFAULT ((0)) FOR [GoLive]
GO
/****** Object:  Default [DF_Product_SKU]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Product] ADD  CONSTRAINT [DF_Product_SKU]  DEFAULT ((1)) FOR [SKU]
GO
/****** Object:  Default [DF_Product_AvailableOnShop]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Product] ADD  CONSTRAINT [DF_Product_AvailableOnShop]  DEFAULT ((0)) FOR [Hidden]
GO
/****** Object:  Default [DF_Product_CanBackOrder]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Product] ADD  CONSTRAINT [DF_Product_CanBackOrder]  DEFAULT ((0)) FOR [CanBackOrder]
GO
/****** Object:  Default [DF_Product_Stars]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Product] ADD  CONSTRAINT [DF_Product_Stars]  DEFAULT ((0)) FOR [Stars]
GO
/****** Object:  Default [DF_ProductAttribute_DataFormat]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductAttribute] ADD  CONSTRAINT [DF_ProductAttribute_DataFormat]  DEFAULT ((0)) FOR [DataFormat]
GO
/****** Object:  Default [DF_ProductImage_CoverImage]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductImage] ADD  CONSTRAINT [DF_ProductImage_CoverImage]  DEFAULT ((0)) FOR [CoverImage]
GO
/****** Object:  Default [DF_ProductReview_Rate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductReview] ADD  CONSTRAINT [DF_ProductReview_Rate]  DEFAULT ((3)) FOR [Rate]
GO
/****** Object:  Default [DF_ProductReview_CreateDate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductReview] ADD  CONSTRAINT [DF_ProductReview_CreateDate]  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_ProductReview_IsPublished]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductReview] ADD  CONSTRAINT [DF_ProductReview_IsPublished]  DEFAULT ((0)) FOR [IsPublished]
GO
/****** Object:  Default [DF_ProductType_IsEnable]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductType] ADD  CONSTRAINT [DF_ProductType_IsEnable]  DEFAULT ((0)) FOR [IsEnable]
GO
/****** Object:  Default [DF_ProductType_HasSummary]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductType] ADD  CONSTRAINT [DF_ProductType_HasSummary]  DEFAULT ((1)) FOR [HasSummary]
GO
/****** Object:  Default [DF_ProductType_HasDescription]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductType] ADD  CONSTRAINT [DF_ProductType_HasDescription]  DEFAULT ((1)) FOR [HasDescription]
GO
/****** Object:  Default [DF_ProductType_HasSize]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductType] ADD  CONSTRAINT [DF_ProductType_HasSize]  DEFAULT ((1)) FOR [HasPackageSize]
GO
/****** Object:  Default [DF_ProductType_HasWeight]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductType] ADD  CONSTRAINT [DF_ProductType_HasWeight]  DEFAULT ((1)) FOR [HasWeight]
GO
/****** Object:  Default [DF_PromotionLog_Discount]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[PromotionLog] ADD  CONSTRAINT [DF_PromotionLog_Discount]  DEFAULT ((0)) FOR [Discount]
GO
/****** Object:  Default [DF_PromotionRule_Priority]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[PromotionRule] ADD  CONSTRAINT [DF_PromotionRule_Priority]  DEFAULT ((0)) FOR [Priority]
GO
/****** Object:  Default [DF_PromotionRule_IsEnable]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[PromotionRule] ADD  CONSTRAINT [DF_PromotionRule_IsEnable]  DEFAULT ((1)) FOR [IsEnable]
GO
/****** Object:  Default [DF_SaleItem_PurchasePrice]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SaleItem] ADD  CONSTRAINT [DF_SaleItem_PurchasePrice]  DEFAULT ((0)) FOR [PurchasePrice]
GO
/****** Object:  Default [DF_SaleItem_Stock]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SaleItem] ADD  CONSTRAINT [DF_SaleItem_Stock]  DEFAULT ((0)) FOR [Stock]
GO
/****** Object:  Default [DF_SaleItem_DeliveryDays]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SaleItem] ADD  CONSTRAINT [DF_SaleItem_DeliveryDays]  DEFAULT ((0)) FOR [DeliveryDays]
GO
/****** Object:  Default [DF_ShopSetting_PriceIndex]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ShopSetting] ADD  CONSTRAINT [DF_ShopSetting_PriceIndex]  DEFAULT ((0)) FOR [PriceIndex]
GO
/****** Object:  Default [DF_ShopSetting_EnableStock]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ShopSetting] ADD  CONSTRAINT [DF_ShopSetting_EnableStock]  DEFAULT ((0)) FOR [EnableStock]
GO
/****** Object:  Default [DF_ShopSetting_ThumbnailWidth]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ShopSetting] ADD  CONSTRAINT [DF_ShopSetting_ThumbnailWidth]  DEFAULT ((100)) FOR [ThumbnailWidth]
GO
/****** Object:  Default [DF_ShopSetting_ThumbnailHeight]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ShopSetting] ADD  CONSTRAINT [DF_ShopSetting_ThumbnailHeight]  DEFAULT ((100)) FOR [ThumbnailHeight]
GO
/****** Object:  Default [DF_SubTax_Percent]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SubTax] ADD  CONSTRAINT [DF_SubTax_Percent]  DEFAULT ((0)) FOR [Percent]
GO
/****** Object:  Default [DF_SupportReply_CreateDate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SupportReply] ADD  CONSTRAINT [DF_SupportReply_CreateDate]  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_SupportReply_IsAdminReply]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SupportReply] ADD  CONSTRAINT [DF_SupportReply_IsAdminReply]  DEFAULT ((0)) FOR [IsAdminReply]
GO
/****** Object:  Default [DF_SupportTicket_CreateDate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SupportTicket] ADD  CONSTRAINT [DF_SupportTicket_CreateDate]  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_SupportTicket_Status]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SupportTicket] ADD  CONSTRAINT [DF_SupportTicket_Status]  DEFAULT ((0)) FOR [Status]
GO
/****** Object:  Default [DF_Tax_Percent]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Tax] ADD  CONSTRAINT [DF_Tax_Percent]  DEFAULT ((0)) FOR [Percent]
GO
/****** Object:  Default [DF_User_Gender]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_Gender]  DEFAULT ((0)) FOR [Gender]
GO
/****** Object:  Default [DF_User_CreateDate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_CreateDate]  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_User_FailedPasswordAnswerAttemptCount]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_FailedPasswordAnswerAttemptCount]  DEFAULT ((0)) FOR [FailedPasswordAnswerAttemptCount]
GO
/****** Object:  Default [DF_User_FailedPasswordAnswerAttemptWindowStart]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_FailedPasswordAnswerAttemptWindowStart]  DEFAULT (getdate()) FOR [FailedPasswordAnswerAttemptWindowStart]
GO
/****** Object:  Default [DF_User_FailedPasswordAttemptCount]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_FailedPasswordAttemptCount]  DEFAULT ((0)) FOR [FailedPasswordAttemptCount]
GO
/****** Object:  Default [DF_User_FailedPasswordAttemptWindowStart]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_FailedPasswordAttemptWindowStart]  DEFAULT (getdate()) FOR [FailedPasswordAttemptWindowStart]
GO
/****** Object:  Default [DF_User_IsApproved]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_IsApproved]  DEFAULT ((1)) FOR [IsApproved]
GO
/****** Object:  Default [DF_User_IsLockedOut]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_IsLockedOut]  DEFAULT ((0)) FOR [IsLockedOut]
GO
/****** Object:  Default [DF_User_LastLockoutDate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_LastLockoutDate]  DEFAULT (getdate()) FOR [LastLockoutDate]
GO
/****** Object:  Default [DF_User_LastLoginDate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_LastLoginDate]  DEFAULT (getdate()) FOR [LastLoginDate]
GO
/****** Object:  Default [DF_User_LastPasswordChangedDate]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[User] ADD  CONSTRAINT [DF_User_LastPasswordChangedDate]  DEFAULT (getdate()) FOR [LastPasswordChangedDate]
GO
/****** Object:  Default [DF_ValidationRule_ForAttibute]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ValidationRule] ADD  CONSTRAINT [DF_ValidationRule_ForAttibute]  DEFAULT ((0)) FOR [ProductAttributeId]
GO
/****** Object:  ForeignKey [FK_Address_Address]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Address]  WITH CHECK ADD  CONSTRAINT [FK_Address_Address] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customer] ([Id])
GO
ALTER TABLE [dbo].[Address] CHECK CONSTRAINT [FK_Address_Address]
GO
/****** Object:  ForeignKey [FK_Address_Country]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Address]  WITH NOCHECK ADD  CONSTRAINT [FK_Address_Country] FOREIGN KEY([CountryCode])
REFERENCES [dbo].[Country] ([CountryCode])
GO
ALTER TABLE [dbo].[Address] CHECK CONSTRAINT [FK_Address_Country]
GO
/****** Object:  ForeignKey [FK_BrandProductType_Brand]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[BrandProductType]  WITH NOCHECK ADD  CONSTRAINT [FK_BrandProductType_Brand] FOREIGN KEY([BrandId])
REFERENCES [dbo].[Brand] ([Id])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[BrandProductType] NOCHECK CONSTRAINT [FK_BrandProductType_Brand]
GO
/****** Object:  ForeignKey [FK_BrandProductType_ProductType]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[BrandProductType]  WITH NOCHECK ADD  CONSTRAINT [FK_BrandProductType_ProductType] FOREIGN KEY([ProductTypeId])
REFERENCES [dbo].[ProductType] ([Id])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[BrandProductType] NOCHECK CONSTRAINT [FK_BrandProductType_ProductType]
GO
/****** Object:  ForeignKey [FK_Cart_Customer]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Cart]  WITH NOCHECK ADD  CONSTRAINT [FK_Cart_Customer] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customer] ([Id])
GO
ALTER TABLE [dbo].[Cart] CHECK CONSTRAINT [FK_Cart_Customer]
GO
/****** Object:  ForeignKey [FK_CartItem_Cart]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem]  WITH NOCHECK ADD  CONSTRAINT [FK_CartItem_Cart] FOREIGN KEY([CartId])
REFERENCES [dbo].[Cart] ([Id])
GO
ALTER TABLE [dbo].[CartItem] CHECK CONSTRAINT [FK_CartItem_Cart]
GO
/****** Object:  ForeignKey [FK_CartItem_Product]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem]  WITH NOCHECK ADD  CONSTRAINT [FK_CartItem_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
GO
ALTER TABLE [dbo].[CartItem] CHECK CONSTRAINT [FK_CartItem_Product]
GO
/****** Object:  ForeignKey [FK_CartItem_SaleItem]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CartItem]  WITH NOCHECK ADD  CONSTRAINT [FK_CartItem_SaleItem] FOREIGN KEY([SaleItemId])
REFERENCES [dbo].[SaleItem] ([Id])
GO
ALTER TABLE [dbo].[CartItem] CHECK CONSTRAINT [FK_CartItem_SaleItem]
GO
/****** Object:  ForeignKey [FK_Category_Category]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Category]  WITH CHECK ADD  CONSTRAINT [FK_Category_Category] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Category] ([Id])
GO
ALTER TABLE [dbo].[Category] CHECK CONSTRAINT [FK_Category_Category]
GO
/****** Object:  ForeignKey [FK_CategoryProduct_Category]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CategoryProduct]  WITH CHECK ADD  CONSTRAINT [FK_CategoryProduct_Category] FOREIGN KEY([CategoryId])
REFERENCES [dbo].[Category] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CategoryProduct] CHECK CONSTRAINT [FK_CategoryProduct_Category]
GO
/****** Object:  ForeignKey [FK_CategoryProduct_Product]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[CategoryProduct]  WITH CHECK ADD  CONSTRAINT [FK_CategoryProduct_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CategoryProduct] CHECK CONSTRAINT [FK_CategoryProduct_Product]
GO
/****** Object:  ForeignKey [FK_Customer_Address]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Customer]  WITH NOCHECK ADD  CONSTRAINT [FK_Customer_Address] FOREIGN KEY([DefaultAddressId])
REFERENCES [dbo].[Address] ([Id])
GO
ALTER TABLE [dbo].[Customer] CHECK CONSTRAINT [FK_Customer_Address]
GO
/****** Object:  ForeignKey [FK_Customer_Country]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Customer]  WITH NOCHECK ADD  CONSTRAINT [FK_Customer_Country] FOREIGN KEY([CountryCode])
REFERENCES [dbo].[Country] ([CountryCode])
GO
ALTER TABLE [dbo].[Customer] CHECK CONSTRAINT [FK_Customer_Country]
GO
/****** Object:  ForeignKey [FK_Order_Cart]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order]  WITH NOCHECK ADD  CONSTRAINT [FK_Order_Cart] FOREIGN KEY([CartId])
REFERENCES [dbo].[Cart] ([Id])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[Order] NOCHECK CONSTRAINT [FK_Order_Cart]
GO
/****** Object:  ForeignKey [FK_Order_Customer]    Script Date: 04/27/2011 18:30:14 ******/
ALTER TABLE [dbo].[Order]  WITH NOCHECK ADD  CONSTRAINT [FK_Order_Customer] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customer] ([Id])
GO
ALTER TABLE [dbo].[Order] CHECK CONSTRAINT [FK_Order_Customer]
GO
/****** Object:  ForeignKey [FK_OrderItem_Order]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItem]  WITH CHECK ADD  CONSTRAINT [FK_OrderItem_Order] FOREIGN KEY([OrderId])
REFERENCES [dbo].[Order] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OrderItem] CHECK CONSTRAINT [FK_OrderItem_Order]
GO
/****** Object:  ForeignKey [FK_OrderItemCustomField_OrderItem]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItemCustomField]  WITH NOCHECK ADD  CONSTRAINT [FK_OrderItemCustomField_OrderItem] FOREIGN KEY([OrderItemId])
REFERENCES [dbo].[OrderItem] ([Id])
GO
ALTER TABLE [dbo].[OrderItemCustomField] CHECK CONSTRAINT [FK_OrderItemCustomField_OrderItem]
GO
/****** Object:  ForeignKey [FK_OrderItemVariation_OrderItem]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[OrderItemVariation]  WITH NOCHECK ADD  CONSTRAINT [FK_OrderItemVariation_OrderItem] FOREIGN KEY([OrderItemId])
REFERENCES [dbo].[OrderItem] ([Id])
GO
ALTER TABLE [dbo].[OrderItemVariation] CHECK CONSTRAINT [FK_OrderItemVariation_OrderItem]
GO
/****** Object:  ForeignKey [FK_Product_Brand]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Product]  WITH NOCHECK ADD  CONSTRAINT [FK_Product_Brand] FOREIGN KEY([BrandId])
REFERENCES [dbo].[Brand] ([Id])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[Product] NOCHECK CONSTRAINT [FK_Product_Brand]
GO
/****** Object:  ForeignKey [FK_Product_ProductType]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Product]  WITH NOCHECK ADD  CONSTRAINT [FK_Product_ProductType] FOREIGN KEY([ProductTypeId])
REFERENCES [dbo].[ProductType] ([Id])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[Product] NOCHECK CONSTRAINT [FK_Product_ProductType]
GO
/****** Object:  ForeignKey [FK_Product_Tax]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[Product]  WITH NOCHECK ADD  CONSTRAINT [FK_Product_Tax] FOREIGN KEY([TaxId])
REFERENCES [dbo].[Tax] ([Id])
GO
ALTER TABLE [dbo].[Product] CHECK CONSTRAINT [FK_Product_Tax]
GO
/****** Object:  ForeignKey [FK_ProductAttribute_ProductType]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductAttribute]  WITH NOCHECK ADD  CONSTRAINT [FK_ProductAttribute_ProductType] FOREIGN KEY([ProductTypeId])
REFERENCES [dbo].[ProductType] ([Id])
GO
ALTER TABLE [dbo].[ProductAttribute] CHECK CONSTRAINT [FK_ProductAttribute_ProductType]
GO
/****** Object:  ForeignKey [FK_ProductCustomField_Product]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductCustomField]  WITH NOCHECK ADD  CONSTRAINT [FK_ProductCustomField_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
GO
ALTER TABLE [dbo].[ProductCustomField] CHECK CONSTRAINT [FK_ProductCustomField_Product]
GO
/****** Object:  ForeignKey [FK_ProductCustomField_ProductAttribute]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductCustomField]  WITH NOCHECK ADD  CONSTRAINT [FK_ProductCustomField_ProductAttribute] FOREIGN KEY([CustomFieldId])
REFERENCES [dbo].[ProductAttribute] ([Id])
GO
ALTER TABLE [dbo].[ProductCustomField] CHECK CONSTRAINT [FK_ProductCustomField_ProductAttribute]
GO
/****** Object:  ForeignKey [FK_ProductImage_Product]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductImage]  WITH CHECK ADD  CONSTRAINT [FK_ProductImage_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ProductImage] CHECK CONSTRAINT [FK_ProductImage_Product]
GO
/****** Object:  ForeignKey [FK_ProductQuestion_Product]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductQuestion]  WITH CHECK ADD  CONSTRAINT [FK_ProductQuestion_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
GO
ALTER TABLE [dbo].[ProductQuestion] CHECK CONSTRAINT [FK_ProductQuestion_Product]
GO
/****** Object:  ForeignKey [FK_ProductReview_Customer]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductReview]  WITH CHECK ADD  CONSTRAINT [FK_ProductReview_Customer] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customer] ([Id])
GO
ALTER TABLE [dbo].[ProductReview] CHECK CONSTRAINT [FK_ProductReview_Customer]
GO
/****** Object:  ForeignKey [FK_ProductReview_Order]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductReview]  WITH CHECK ADD  CONSTRAINT [FK_ProductReview_Order] FOREIGN KEY([OrderId])
REFERENCES [dbo].[Order] ([Id])
GO
ALTER TABLE [dbo].[ProductReview] CHECK CONSTRAINT [FK_ProductReview_Order]
GO
/****** Object:  ForeignKey [FK_ProductReview_Product]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductReview]  WITH CHECK ADD  CONSTRAINT [FK_ProductReview_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
GO
ALTER TABLE [dbo].[ProductReview] CHECK CONSTRAINT [FK_ProductReview_Product]
GO
/****** Object:  ForeignKey [FK_ProductVariation_ProductAttribute]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductVariation]  WITH NOCHECK ADD  CONSTRAINT [FK_ProductVariation_ProductAttribute] FOREIGN KEY([VariationId])
REFERENCES [dbo].[ProductAttribute] ([Id])
GO
ALTER TABLE [dbo].[ProductVariation] CHECK CONSTRAINT [FK_ProductVariation_ProductAttribute]
GO
/****** Object:  ForeignKey [FK_ProductVariation_SaleItem]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ProductVariation]  WITH NOCHECK ADD  CONSTRAINT [FK_ProductVariation_SaleItem] FOREIGN KEY([SaleItemId])
REFERENCES [dbo].[SaleItem] ([Id])
GO
ALTER TABLE [dbo].[ProductVariation] CHECK CONSTRAINT [FK_ProductVariation_SaleItem]
GO
/****** Object:  ForeignKey [FK_PromotionExclusiveRules_PromotionRule]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[PromotionExclusiveRules]  WITH CHECK ADD  CONSTRAINT [FK_PromotionExclusiveRules_PromotionRule] FOREIGN KEY([PromotionRuleId1])
REFERENCES [dbo].[PromotionRule] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[PromotionExclusiveRules] CHECK CONSTRAINT [FK_PromotionExclusiveRules_PromotionRule]
GO
/****** Object:  ForeignKey [FK_PromotionExclusiveRules_PromotionRule1]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[PromotionExclusiveRules]  WITH CHECK ADD  CONSTRAINT [FK_PromotionExclusiveRules_PromotionRule1] FOREIGN KEY([PromotionRuleId2])
REFERENCES [dbo].[PromotionRule] ([Id])
GO
ALTER TABLE [dbo].[PromotionExclusiveRules] CHECK CONSTRAINT [FK_PromotionExclusiveRules_PromotionRule1]
GO
/****** Object:  ForeignKey [FK_SaleItem_Product]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SaleItem]  WITH NOCHECK ADD  CONSTRAINT [FK_SaleItem_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Product] ([Id])
GO
ALTER TABLE [dbo].[SaleItem] CHECK CONSTRAINT [FK_SaleItem_Product]
GO
/****** Object:  ForeignKey [FK_ShippingCostRule_Shipping]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ShippingCostRule]  WITH NOCHECK ADD  CONSTRAINT [FK_ShippingCostRule_Shipping] FOREIGN KEY([ShippingId])
REFERENCES [dbo].[Shipping] ([Id])
GO
ALTER TABLE [dbo].[ShippingCostRule] CHECK CONSTRAINT [FK_ShippingCostRule_Shipping]
GO
/****** Object:  ForeignKey [FK_SubTax_Country]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SubTax]  WITH NOCHECK ADD  CONSTRAINT [FK_SubTax_Country] FOREIGN KEY([CountryCode])
REFERENCES [dbo].[Country] ([CountryCode])
GO
ALTER TABLE [dbo].[SubTax] CHECK CONSTRAINT [FK_SubTax_Country]
GO
/****** Object:  ForeignKey [FK_SubTax_Tax]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SubTax]  WITH CHECK ADD  CONSTRAINT [FK_SubTax_Tax] FOREIGN KEY([TaxId])
REFERENCES [dbo].[Tax] ([Id])
GO
ALTER TABLE [dbo].[SubTax] CHECK CONSTRAINT [FK_SubTax_Tax]
GO
/****** Object:  ForeignKey [FK_SupportReply_SupportTicket]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SupportReply]  WITH NOCHECK ADD  CONSTRAINT [FK_SupportReply_SupportTicket] FOREIGN KEY([SupportTicketId])
REFERENCES [dbo].[SupportTicket] ([Id])
GO
ALTER TABLE [dbo].[SupportReply] CHECK CONSTRAINT [FK_SupportReply_SupportTicket]
GO
/****** Object:  ForeignKey [FK_SupportTicket_Customer]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[SupportTicket]  WITH NOCHECK ADD  CONSTRAINT [FK_SupportTicket_Customer] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customer] ([Id])
GO
ALTER TABLE [dbo].[SupportTicket] CHECK CONSTRAINT [FK_SupportTicket_Customer]
GO
/****** Object:  ForeignKey [FK_ValidationRule_ProductAttribute]    Script Date: 04/27/2011 18:30:15 ******/
ALTER TABLE [dbo].[ValidationRule]  WITH NOCHECK ADD  CONSTRAINT [FK_ValidationRule_ProductAttribute] FOREIGN KEY([ProductAttributeId])
REFERENCES [dbo].[ProductAttribute] ([Id])
GO
ALTER TABLE [dbo].[ValidationRule] CHECK CONSTRAINT [FK_ValidationRule_ProductAttribute]
GO
